<div class="top">
    <!-- visitor -->
    <div class="_visitor">
        <div class="visitorbox">
            <div class="item">welcome</div>
            <div class="item"><a href="#default/cart">购物车</a>
            </div>
            {{#if loginer}}
                <div class="item"><a id="loginer_info" class="bar-button icon-user" href="./personal.html">{{loginer.info.name}}</a>
                </div>
                <div class="item"><a event-click="{{'$Event.user_login_out'}}" id="login_out" href="#">注销</a>
                </div>
            {{#else}} 
                {{#if $Cache._in_sign_in_or_up}} 
                {{#else}}
                <div class="item"><a class="icon-user" href="#default/register" target="_blank">登陆</a>
                </div>
                <div class="item"><a class="icon-user2" href="#default/register" target="_blank">注册</a>
                </div>
                {{/if}} 
            {{/if}}
        </div>
    </div>

    <!-- banner -->
    <div class="_banner">
        <div class="item">
            <a href="#default/main">
                <div class="_logo">{{bus_info.info.title}}</div>
            </a>
        </div>
        <div class="item">
            <div class="_searchbox">
                <div class="box">
                    <input type="text" name="searchtext" class="textbox" bind-input="{{'$Cache.search_text'}}" />
                    <a href="#default/goods_search_result?q={{$Cache.search_text}}" class="icon-search"></a>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="_cart">
                <div class="box">
                    <i class="icon-cart"></i>
                    <span>我的购物车：</span>
                    <a href="#default/cart">
                        <span class="number">0件</span>
                    </a>
                </div>
                <div class="_cart_goods">
                    <div class="_cart_box">
                    {{#each user.cart_detail}}
                        <div>
                        {{#each goods_info}}
                            <cart_goods_item src="{{goods.preview_img_url}}?imageView/1/w/40/h/40" name="{{goods.goods_name}}" price="{{goods.price}}" number="8"></cart_goods_item>
                        {{/each}}
                        </div>
                    {{/each}}
                        <cart_goods_item src="images/roll1.jpg" name="roll1df sdfsdfs fsdfsdfcvcvcvvx" price="88" number="8"></cart_goods_item>
                        <cart_goods_item src="images/roll1.jpg" name="roll1df sdfsdfs fsdfsdfcvcvcvvx" price="88" number="8"></cart_goods_item>
                        <cart_goods_item src="images/roll1.jpg" name="roll1df sdfsdfs fsdfsdfcvcvcvvx" price="88" number="8"></cart_goods_item>
                        <cart_goods_item src="images/roll1.jpg" name="roll1df sdfsdfs fsdfsdfcvcvcvvx" price="88" number="8"></cart_goods_item>
                    </div>
                    <div class="_go_to_cart">
                        总计:
                        <span class="_price_count">$5555</span>
                        <a href="#default/cart">
                            <button class="_go_to_cart_btn">确认</button>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- navbar -->
    <div class="_navbar">
        <div class="block">

        </div>
        <div class="navlist">
            <a href="#default/main" class="navitem first">首页</a>
            <a href="#default/classify" class="navitem">
                商品分类
               <!--  <div class="kindslist">
                    <div class="item">分类彩蛋哦</div>
                    <div class="item">分类彩蛋哦</div>
                    <div class="item">分类彩蛋哦</div>
                    <div class="item">分类彩蛋哦</div>
                </div> -->
            </a>
            <a href="#default/goods_list?id=3" class="navitem">全部商品</a>
            <a href="#default/goods_sale?id=2" class="navitem">销量最高</a>
            <a href="#default/storeinfo" class="navitem">关于本店</a>
            <a href="" class="navitem">点击收藏</a>
            <a href="#default/help" class="navitem">帮助</a>
        </div>
    </div>
</div>

{{#if bus_info.config.using_bg_img}}
<img style="position: fixed;width: 100%;height: 100%;z-index: -1;top:0;left: 0;" src="{{bus_info.config.using_bg_img}}{{#if bus_info.config.is_bg_img_blur}}?imageMogr2/blur/10x10{{/if}}">
{{/if}}

<xmp type="tag" name="cart_goods_item">
    <div class="_cart_goods_item">
        <a href="${href}">
            <img class="_cart_goods_item_img" bind-src="${src}" />
        </a>
        <div class="_cart_goods_item_detail">
            <div class="_cart_goods_item_detail_top">
                <a href="${href}">
                    <div class="_cart_goods_item_name">${name}</div>
                </a>
            </div>
            <div class="_cart_goods_item_detail_bottom">
                <div class="_cart_goods_item_price">$${price}</div>
                <div class="_cart_goods_item_number">
                    <button class="numbtn">-</button>x${number}
                    <button class="numbtn">+</button>
                </div>
            </div>
        </div>
        <button class="_delete">
            X
        </button>
    </div>
</xmp>

<script type="text/vm">
    function (vm) {
        require(["common"], function(jSouper) {
            // var sign_in_btn_node = vm.queryElement({id:"sign_in_btn"})[0];
            // var sign_up_btn_node = vm.queryElement({id:"sign_up_btn"})[0];
            // var login_out_btn_node = vm.queryElement({id:"login_out"})[0];
            if (location.pathname !== "/sign_in.html") {
                var cb_url = "&cb_url=" + encodeURIComponent(location.href);
                // sign_in_btn_node.href += cb_url;
                // sign_up_btn_node.href += cb_url;
                App.set("$Cache.cb_url", cb_url);
            } else {
                App.set("$Cache._in_sign_in_or_up", true);
            }
            //注销功能
            jSouper.ready(function() {
                App.set("$Event.user_login_out", function() {
                    require(["Cookies"], function(Cookies) {
                        Cookies.set("loginSession", "");
                    });
                    App.set("loginer", null);
                });
            });
        });
    }
</script>